<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
    // 1.将A5F3转成2进制
        var x = 'A5F3';
        var y = parseInt(x,16);
        var result = y.toString(2);
        console.log(result);
       
        
    // 2.99乘法表
        //1
        var num1 = 1;
        var num2 = 1;
        while(num2 < 10){
            document.write(num1+"×"+num2+"="+(num1*num2)+"&nbsp&nbsp");
            if((num1*num2) != (num2*num2)){
                num1++;
            }else {
                document.write("<br>");
                num1 = 1;
                num2++;
            }
        }
        //2
        for(var i = 1;i <= 9;i++){
            for(var j = 1;j <= i;j++){
                document.write(j+"×"+i+"="+(i*j)+"&nbsp&nbsp");
            }
            document.write("<br>");
        }

    // 3.输入年月（用数组）
    //       3.1.计算当月有多少天,4 6 9 11 --30
    //       3.2.计算还剩多少天 
        var inputTime = prompt("输入年月日(例:2022.10.14)");
        const arr = inputTime.split('.');
        var yearNum;
        var monthNum = 31;
        //年
        if((arr[0]%4 == 0 && arr[0]%100 != 0) || arr[0]%400 == 0){
            yearNum = 366;
            monthNum = 29;
        }else{
            yearNum = 365;
            monthNum = 28;
        }
        //月
        if(arr[1] == 4 || arr[1] == 6 || arr[1] == 9 || arr[1] == 11){
            monthNum = 30;
        }else if(arr[1] != 2){
            monthNum = 31;
        }
        //日 
        var dayNum = 0;
        var x;
        for(i = 1;i < arr[1];i++){
            if(i == 4 || i == 6 || i == 9 || i == 11){
                x = 30;
            }else if(i == 2){
                if(yearNum == 366 ){
                    x = 29;
                }else x = 28;
            }else x = 31;
            
            dayNum += x;    
        }
        console.log(arr[0]+"年"+arr[1]+"月"+arr[2]+"日,当月剩余"+(monthNum - arr[2])+"天,当年剩余"+(yearNum - dayNum - arr[2])+"天");



        



    </script>
</body>
</html>